#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QWidget>
#include <QtWidgets/QMainWindow>
#include <QtGui>
#include <QLabel>
#include <QtWidgets>
#include <QMainWindow>
#include <QMouseEvent>
#include <QPointF>
#include <QEvent>
#include <QLineEdit>
#include <QFormLayout>
#include <QSpinBox>
#include <QSlider>
#include <QDoubleSpinBox>
#include <QDialogButtonBox>
#include <QToolButton>
#include <QDir>
#include <QMouseEvent>
#include <QDesktopServices>
#include <QUrl>

#include <matrix.h>
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    Matrix a;
    QImage* img=nullptr;
    Matrix *b[30];
    int reimgstep=0;
    int nowimgstep=-1;
    void baocun();
    Matrix addimg;
    int flagroll=0;

private slots:
    void on_actionopenfile_triggered();

    void on_actionsave_triggered();

    void on_actionsaveas_triggered();

    void on_actionflip_ud_triggered();

    void on_actionflip_lr_triggered();

    void on_actioncut_triggered();

    void on_actionmosaic_triggered();

    void on_actiongrey_triggered();

    void on_actionlight_triggered();

    void slot_button_light(QLineEdit *lineedit_light);

    void slot_button_gaosi(QLineEdit *lineedit_gaosi);

    void slot_button_zhongzhi(QLineEdit *lineedit_zhongzhi);

    void slot_button_junzhi(QLineEdit *lineedit_junzhi);

    void slot_button_baohedu(QLineEdit *lineedit_baohedu);

    void slot_button_duibidu(QLineEdit *lineedit_duibidu);

    void slot_button_gama(QLineEdit *lineedit_gama);

    void mouseMoveEvent(QMouseEvent *ev);

    void on_actionhelp_triggered();

    void on_actionresize_triggered();

    void on_actionbackstep_triggered();

    void on_actiongamma_triggered();

    void on_actionruihua_triggered();

    void on_actionbytq_triggered();

    void on_actionahead_triggered();


    void on_actionrotate0_triggered();

    void on_actionrotate1_triggered();

private:
    Ui::MainWindow *ui;

    QDockWidget *dock_Image;                    //图像窗口
    QDockWidget *dock_Image_new;                //图像窗口2
    QDockWidget *dock_light;                    //亮度参数输入窗口
    QDockWidget *dock_grey;                     //灰度

    QString currentPath;                        //当前图像的路径
    QString light_int;                          //亮度参数

    QLabel *imgLabel;                           //图像显示框
    QLabel *getlabel;                           //参数输入框
    QLabel *mousepressLabel;                    //显示点击鼠标时坐标
    QLabel *mousereleaseLabel;                  //显示释放鼠标时坐标
    QLabel *mouseNowLabel;
    QLabel *mouseLabel;

    QPointF p_press;                            //点击时鼠标坐标
    QPointF p_release;                          //释放时鼠标坐标
    QPointF wheeldelta;                         //获得滚轮转角

    QLineEdit *lineedit_light;
    QLineEdit *lineedit_gaosi;
    QLineEdit *lineedit_zhongzhi;
    QLineEdit *lineedit_junzhi;
    QLineEdit *lineedit_baohedu;
    QLineEdit *lineedit_duibidu;
    QLineEdit *lineedit_gama;

    QPushButton *button_light;//如果想在主窗口创建控件，第二个参数QWidget *parent改为this
    QPushButton *button_gaosi;
    QPushButton *button_zhongzhi;
    QPushButton *button_junzhi;
    QPushButton *button_baohedu;
    QPushButton *button_duibidu;
    QPushButton *button_gama;

    QSlider *horizontalSlider_light;
    QSlider *horizontalSlider_gaosi;
    QSlider *horizontalSlider_zhongzhi;
    QSlider *horizontalSlider_junzhi;
    QSlider *horizontalSlider_baohedu;
    QSlider *horizontalSlider_duibidu;
    QSlider *horizontalSlider_gama;

    int step = 0;                               //设置中间参数step用于将获取的数值转换成int

    void showimage();                           //初始化图像
    void getlabelshow();                        //侧边工具栏
    void mousePressEvent(QMouseEvent *event);   //鼠标点击事件显示当前鼠标坐标位置
    void mouseReleaseEvent(QMouseEvent *event); //鼠标释放事件显示当前鼠标坐标位置
    void wheelEvent(QWheelEvent *event);        //滚轮事件
};



#endif // MAINWINDOW_H
